<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Team Bonus Summary</title>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.leanModal.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script language="javascript"> 
function transfer(date_begin,date_end){

	window.location.href = 'http://<?php echo WEB_IP?>/repairparts/repair-wizard-new-distribution/date_begin/'+ date_begin + '/date_end/' + date_end + '/next/yes';
}

</script>

</head>
<body style="font-family:Arial, Helvetica, sans-serif; line-height:20px;">
<form method = "post" action = "">
<h2>Repair Bonus Summary for cycle ( <?php echo $this->cycle;?> )</h2>
<h3><?php echo $this->dateBegin;?> ~ <?php echo $this->dateEnd;?></h3>
<?php $stfDetail = new Model_DbTable_Roster_Stafflogindetail();?>
<table width="700" border="1" cellspacing="1" cellpadding="5">
	<tr>
		<th>Shop Group</th>
		<th>Stock Lost</th>
		<th width = "100px">Staff Name</th>
		<th width = "100px">Original Bonus</th>
		<th width = "100px">lost</th>
		<th width = "100px">Bonus - lost</th>
		<th>Carry Stock Lost</th>
	</tr>
<?php foreach($this->bonusList as $k => $v){?>
	<tr>
		<td rowspan = "<?php count($v['bonus_list'])?>"><?php echo $v['shop_code']?></td>
		<td rowspan = "<?php count($v['bonus_list'])?>"><?php echo $v['total_stock_lost'];?></td>
		<td colspan = "4" width = "400px">
			<table border = "1">
			<?php foreach ($v['bonus_list'] as $k2 => $v2){
					$stfD = $stfDetail->getDetail($v2['staff_id']);
					$fName = Model_EncryptHelper::getSslPassword($stfD['n']);
					$percent = count($v['bonus_list']);
					?>
				<tr>
				<td width = "100px" ><?php echo $fName."(".$stfD['ni'].")"?></td>
				<td width = "100px" align = "center"><?php echo $v2['final_bonus']?></td>
				<td width = "100px" align = "center"><?php echo round(($v['total_stock_lost']/$percent),2)?></td>
				<td width = "100px" align = "center"><input type = "text" name = "sBonus[<?php echo $v2['id']?>]" value = "<?php echo $v2['net_bonus']?>" size = "8"></input></td>
				</tr>
			<?php }?>
			</table>
		</td>
		<td rowspan = "<?php count($v['bonus_list'])?>"><input type = "text" name = "cStockLost[<?php echo $v['id_shop']?>]" value = "<?php echo $v['carry_stock_lost']?>" size = "8"></input></td>
	</tr>
<?php }?>

</table>
<br/>
<div id = "payrollWizard" <?php if(!$this->nextCheck){?>style = "visibility:hidden;<?php }?>">
<input type = "submit" name ="submit" id = "submit" value = "Confirm&Next" style = "margin-left:650px;"></input>
</div>
</form>

</body>
</html>